from selenium.webdriver.common.action_chains import ActionChains
from selenium import webdriver
from time import sleep
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys

test1=webdriver.Chrome()
test1.get("https://www.baidu.com/")
sleep(2)
# news=test1.find_element(By.LINK_TEXT,"新闻")
# sleep(2)
# ActionChains(test1).click_and_hold(news).perform()
# sleep(2)
# ActionChains(test1).release(news).perform()
# sleep(4)
seach=test1.find_element(By.ID,"kw")
ActionChains(test1).click(seach).pause(2).send_keys("ruanjian").pause(2).click_and_hold().pause(2).move_by_offset(-100,0).perform()